# -*- coding: utf-8 -*-

#set up matplotlib and the figure
import matplotlib.pyplot as plt
import csv
plt.figure

def convert(lista):
    lista_converter = []
    for x in lista:
        lista_converter.append(int(float(x)))
    return lista_converter

def getLista():
    reader = csv.reader(open("pesquisa2.csv" , "r"))
    
    for lista_linha in reader:
        if lista_linha.__contains__('0480 - Informática (Ensino de)'):
            lista = lista_linha
    del lista[0]
    while len(lista) < 16:
        lista.append('0.0')
    lista = convert(lista)


    print lista

    print max(lista)
    return lista

#create data
x_series = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
y_series = getLista()
 
#plot data
plt.plot(x_series, y_series, linewidth = 3)
 
#add in labels and title
plt.xlabel("anos")
plt.ylabel("Nr. Alunos")
plt.title("Alunos inscritos")
 
#add limits to the x and y axis
plt.xlim(0, 15)
plt.ylim(0, 200) 
 
#create legend
plt.legend(loc="upper left")
#getLista()
plt.grid(True)

fig = plt.gcf()
fig.subplots_adjust(bottom=0.2)


plt.show()


